package com.example.demo.controller;

import com.example.demo.model.employee;
import com.example.demo.model.goods;
import com.example.demo.model.purchaseDetails;
import com.example.demo.service.employeeService;
import com.example.demo.service.goodsService;
import com.example.demo.service.purchaseDetailsService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;

//普通用户控制层
@Controller
@RequestMapping("/user/normalUser")
public class normalController {

//查询个人信息
    @Resource
    private employeeService employee;
    @RequestMapping("/personInformation")
    public String personInformation(Model model)
    {
        employee.deleteAllByEnameIsNull();
        List<com.example.demo.model.employee>  employeeList= employee.findAll();
        model.addAttribute("empl",employeeList);
        return ("/normalUser/personInformation");
    }
//查询采购信息
    @Resource
    private purchaseDetailsService purchaseDetails;
    @RequestMapping("/purchaseInformation")
    public String purchaseInformation(Model model)
    {
        purchaseDetails.deleteAllByPdpriceIsNull();
        List<com.example.demo.model.purchaseDetails> purchaseDetailsList= purchaseDetails.findAll();
        model.addAttribute("purchaseDe",purchaseDetailsList);

        return ("/normalUser/purchaseInformation");
    }

    // 查询商品信息
    @Resource
    private goodsService good;
    @RequestMapping("/goodsInformation")
    public String goodsInformation(Model model)
    {
        good.deleteAllByGnameIsNull();
        List<goods>  goodsList= good.findAll();
        model.addAttribute("goodsl",goodsList);
        return ("/normalUser/goodsInformation");
    }





}



